package com.crux.demo;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;
@Slf4j
@RestController
@RequestMapping(value = "/api/demo")
public class DemoController {
    @Autowired
    private DemoService demoService;

    @GetMapping(value = "/product/v1")
    public String product(){
        return demoService.product();
    }

    @GetMapping(value = "/product/v2")
    public String productV2(@RequestParam(required = false) String version){
        return demoService.productV2(version);
    }

    @GetMapping(value = "product/header")
    public String productHeader(@RequestParam(required = false) String keyName){
        return demoService.productHeader(keyName);
    }
}
